import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { SequelizeModule } from '@nestjs/sequelize';
import { DatabaseModule } from 'src/database/database.module';
import { jwtConstants } from '../auth/constants';
import { LoginLogController } from './controller/login-log.controller';
import { LoginLogEntity } from './entity/loginLog.entity';
import { LoginLogProviders } from './provider/loginLog.providers';
import { LoginLogService } from './service/login-log.service';

@Module({
  controllers: [LoginLogController],
  imports: [
    DatabaseModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: jwtConstants.expiresSecond }, // token 过期时效
    }),
    SequelizeModule.forFeature([LoginLogEntity]),
  ],
  providers: [LoginLogService, ...LoginLogProviders],
  exports: [LoginLogService],
})
export class LoginLogModule {}
